import React, { Component } from "react";
import axios from 'axios';

export default class Proxy extends Component {
    render() {
        return <div>
            <h2>代理测试</h2>
            <hr />
            
            5000 <button onClick={this.getStudents}>点击获取学员信息</button>  <button onClick={this.getEleCar}>获取电车信息</button>
            <hr />
            5001 <button onClick={this.getCars}>获取汽车信息</button>
            <hr />
            知乎: <button onClick={this.getZhiHu}>获取知乎热榜</button>
        </div>
    }

    //
    getZhiHu = async () => {
        let result = await axios.get('/zhihu/api/v3/feed/topstory/hot-lists/total?limit=50&desktop=true')
        console.log(result);
    }

    //获取电车信息
    getEleCar = async () => {
        let result = await axios.get('/api1/cars');
        console.log(result);
    }

    //获取学生信息
    getStudents = async () => {
        let result = await axios.get('/api1/students');
        console.log(result);
    }

    //获取汽车信息
    getCars = async () => {
        let result = await axios.get('/api2/cars');
        console.log(result);
    }
}
